<%-- 
    Document   : ListCars
    Created on : Nov 1, 2011, 11:53:00 PM
    Author     : Mr-aUgust
--%>

<%@page pageEncoding="UTF-8"%>
<%@ page session="true" import="java.util.Collection, DAL.*" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/WEB-INF/taglib139.tld" prefix="pg" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>East2West Tours and Travels</title>
        <style type="text/css">
            #Table
            {
            border:1px solid green;
            }
            th
            {
             border:1px solid green;
            background-color:green;
            color:white;
            }
            .td
            {
             border:1px solid green;
            }
            .font
            {
                font-family:"Times New Roman", Times, serif;
                font-size:x-large;
                font-weight:bold;
                width:200px;
                margin-left:auto;
                margin-right:auto;
                color:#0707e7;
            }
            .sizeedit
            {
                width:50px;
            }
        </style>
    </head>
    <body>
         <%
         session.removeAttribute("status");
         session.removeAttribute("statusH");
        
        CarBean cb=new CarBean();
        Collection coll=cb.SelectCar();
        request.setAttribute("carb",coll);
        %>
    <div class="font">List Of Cars </div>    
    <table width="100%" id="Table">  
        <tr>
            <th>CarID</th>
            <th>Image</th>
            <th>CarName</th>
            <th>Seats</th>
            <th>Quantity</th>
            <th>Price Date</th>
            <th>Price Hour</th>
            <th>Price Km</th>
            <th>Model Car</th>    
            <th>Type</th>
            <th>Edit</th>
            <th>Delete</th>
        </tr>
        <pg:paging pageSize="10" url="management.jsp?page=ListCars"  >
        <c:forEach items="${carb}" var="cr">
            <pg:item>
        <tr>
            <td class="td">${cr.carID}</td>
            <td class="td" width="60px"><img src="../${cr.image}" width="60px" height="40px" /></td>
            <td class="td">${cr.carName}</td>
            <td class="td">${cr.seating}</td>
             <td class="td">${cr.quantity}</td>
            <td class="td"><f:formatNumber value="${cr.priceDate}" pattern="$#,###"/> </td>
            <td class="td"><f:formatNumber value="${cr.priceHour}" pattern="$#,###"/></td>
            <td class="td"><f:formatNumber value="${cr.priceKilomet}" pattern="$#,###"/></td>
            <td class="td">${cr.modelName}</td>
            <td class="td">${cr.carType}</td>
            <td class="td" width="40px">
                <form action="../ControllerCar" method="post" name="edit">
                    <input type="hidden" name="carID" value="${cr.carID}" />
                    <input type="hidden" name="image" value="${cr.image}" />
                    <input type="hidden" name="carname" value="${cr.carName}" />
                    <input type="hidden" name="seating" value="${cr.seating}" />
                    <input type="hidden" name="conditioner" value="${cr.airConditioner}" />
                    <input type="hidden" name="driver" value="${cr.quantity}" />
                    <input type="hidden" name="PriceDate" value="${cr.priceDate}" />
                    <input type="hidden" name="PriceHour" value="${cr.priceHour}" />
                    <input type="hidden" name="Pricekilomet" value="${cr.priceKilomet}" />
                    <input type="hidden" name="CarType" value="${cr.carType}"/>
                    <input type="hidden" name="ModelCar" value="${cr.modelName}"/>
                    <input type="hidden" name="description" value="${cr.description}"/>
                    <input type="submit" class="sizeedit" name="edit" value="Edit"/>
                </form>
            </td>
            <td class="td" width="60px">
                <form action="../ControllerCar" method="post" name="delete">
                    <input type="hidden" name="carID" value="${cr.carID}" />
                    <input type="submit" name="delete" value="Delete" OnClick="return confirm('Are you sure you want delete record this?');"/>
                </form>
            </td>
        </tr>
    </pg:item>       
    </c:forEach>
        <pg:index>
          <pg:page><%=thisPage%></pg:page>
        </pg:index>
    </pg:paging>
    </table>
        <form action="management.jsp?page=CreateCar" method="post" name="link">
            <table>
                <tr>
                    <td></td>
                </tr>
                <tr>
                    <td><input type="submit" value="Add new a car" /></td>
                </tr>
            </table>
            
        </form>
    </body>
</html>

